package com.kanqiubao.kq.adapter.recoding;

import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.kanqiubao.kq.R;
import com.kanqiubao.kq.ThisAppApplication;
import com.kanqiubao.kq.adapter.BaseAdapter;

import org.jetbrains.annotations.NotNull;

/**
 * 选择日期
 */
public class RecodingDayListAdapter extends BaseAdapter<String> {
    private int mClickPostion=-1;

    public void setmClickPostion(int pos) {
        mClickPostion = pos;
        notifyDataSetChanged();
    }

    public RecodingDayListAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, String s) {
        if (s.equals("-1")) {
            baseViewHolder.setText(R.id.sc_num_id, "");
        } else {
            baseViewHolder.setText(R.id.sc_num_id, s);
        }
        if (baseViewHolder.getLayoutPosition() == mClickPostion) {
            baseViewHolder.setTextColor(R.id.sc_num_id,ThisAppApplication.getInstance().getResources().getColor(R.color.white));
            baseViewHolder.setTextColor(R.id.sc_c_id,ThisAppApplication.getInstance().getResources().getColor(R.color.white));
            baseViewHolder.setBackgroundColor(R.id.rl_root_id, ThisAppApplication.getInstance().getResources().getColor(R.color.sc_list_txt_color2));
        } else {
            baseViewHolder.setBackgroundColor(R.id.rl_root_id, ThisAppApplication.getInstance().getResources().getColor(R.color.white));
            baseViewHolder.setTextColor(R.id.sc_num_id,ThisAppApplication.getInstance().getResources().getColor(R.color.sc_list_txt_color1));
            baseViewHolder.setTextColor(R.id.sc_num_id,ThisAppApplication.getInstance().getResources().getColor(R.color.recoding_rl_item));

        }
    }
}
